home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-01-28 | 7.4 KB | 269 lines |
- 10 'METERS - Meters (DC) : 15 DEC 85 rev. 29 SEP 96
- 20 IF EX$=""THEN EX$="exit"
- 30 PROG$="meters"
- 40 COMMON EX$,PROG$,R,E 'for chaining to PRECIRES
- 50 CLS:KEY OFF
- 60 COLOR 7,0,1
- 70 PI=3.14159
- 80 UL$=STRING$(80,205) 'underline
- 90 ER$=STRING$(80,32) 'erase
- 100 U$="####,###.###"
- 110 DIM A(50) 'AWG sizes (American Wire Gauge)
- 120 '
- 130 '.....AWG wire sizes
- 140 K#= (0.46/0.005)^(1/39) 'incremental multiplier
- 150 FOR Z=1 TO 50
- 160 N=Z+3
- 170 WIRE=0.46/K#^N 'wire diameter in inches
- 180 A(Z)=WIRE 'wire diameter in inches
- 190 NEXT Z
- 200 '
- 210 COLOR 15,2
- 220 PRINT " METERS (Direct-Current)";TAB(57);"by George Murphy VE3ERP ";
- 230 COLOR 1,0:PRINT STRING$(80,223);
- 240 COLOR 7,0
- 250 T=7
- 260 PRINT TAB(T);
- 270 PRINT "This program calculates values of shunts and multipliers required"
- 280 PRINT TAB(T);
- 290 PRINT "to convert basic d'Arsonval meter movements into practical meters"
- 300 PRINT TAB(T);
- 310 PRINT "for measuring DC current or voltage."
- 320 PRINT UL$;
- 330 PRINT " Press number in < > to select instrument:"
- 340 PRINT UL$;
- 350 PRINT " < 1 > Ammeter"
- 360 PRINT " < 2 > Voltmeter"
- 370 PRINT UL$;
- 380 PRINT " or press < 0 > to EXIT....."
- 390 Z$=INKEY$
- 400 IF Z$="0"THEN CLS:RUN EX$
- 410 IF Z$="1"THEN 450
- 420 IF Z$="2"THEN 1670
- 430 GOTO 390
- 440 '
- 450 '.....ammeter
- 460 LOCATE CSRLIN-1
- 470 PRINT " Press number in < > to choose standard units of measure:"
- 480 PRINT UL$;
- 490 PRINT " < 3 > Metric"
- 500 PRINT " < 4 > U.S.A./Imperial"
- 510 PRINT UL$;
- 520 Z$=INKEY$
- 530 IF Z$="3"THEN UM=25.4:UM$="mm.":GOTO 560
- 540 IF Z$="4"THEN UM=1:UM$="in.":GOTO 560
- 550 GOTO 520
- 560 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 570 GOSUB 2150 'preface text
- 580 GOSUB 2560
- 590 GOTO 670
- 600 '
- 610 '.....display input
- 620 LOCATE CSRLIN-1:PRINT STRING$(7,32)
- 630 LOCATE CSRLIN-1,39:PRINT STRING$(40,32)
- 640 LOCATE CSRLIN-1,39:PRINT ".......";USING U$;Q;
- 650 RETURN
- 660 '
- 670 '.....ammeter
- 680 CLS
- 690 PRINT TAB(37);"AMMETER"
- 700 PRINT UL$;
- 710 PRINT
- 720 T=26:COLOR 0,7
- 730 LOCATE CSRLIN,T:PRINT " shunt wire (coiled) "
- 740 LOCATE CSRLIN,T:PRINT " VARPTRSOUNDSOUND\/\/\SOUNDSOUNDCOLOR "
- 750 LOCATE CSRLIN,T:PRINT " CALL VARPTRSOUNDSOUNDSOUNDCOLOR CALL "
- 760 LOCATE CSRLIN,T:PRINT " I(in) SOUNDSOUNDMOTORSOUNDSOUND<0xB4!> \ BLOADSOUNDSOUNDMOTORSOUNDSOUND I(out) "
- 770 LOCATE CSRLIN,T:PRINT " +CLSSOUNDSOUNDSOUND'- "
- 780 LOCATE CSRLIN,T:PRINT " meter "
- 790 COLOR 7,0
- 800 PRINT
- 810 INPUT " ENTER: Meter Movement (full scale).....(mA.)";Z:A=Z/1000
- 820 IF Z=0 THEN LOCATE CSRLIN-1:GOTO 810
- 830 Q=Z:GOSUB 610:PRINT " mA."
- 840 INPUT " ENTER: Internal Resistance............(ohms)";RM
- 850 IF RM=0 THEN LOCATE CSRLIN-1:GOTO 840
- 860 Q=RM:GOSUB 610:PRINT " ohms"
- 870 INPUT " ENTER: New Dial Full Scale............(amps)";B
- 880 IF B=0 THEN LOCATE CSRLIN-1:GOTO 870
- 890 Q=B:GOSUB 610:PRINT " amps"
- 900 C=B*250
- 910 FOR Z=40 TO 1 STEP -1
- 920 CM=(A(Z)*10^3)^2 'circular mils
- 930 IF CM>C THEN W=Z:GOTO 1000
- 940 NEXT Z
- 950 IF W<10 THEN BEEP:COLOR 0,7:PRINT:PRINT " NOT PRACTICAL ! " 'AWG<10
- 960 PRINT:COLOR 0,7:PRINT " Press any key to start over ":COLOR 7,0
- 970 Z$=INKEY$:IF Z$<>""THEN 680
- 980 GOTO 970
- 990 '
- 1000 PRINT TAB(9);"Shunt Wire minimum diameter..........";
- 1010 PRINT USING U$;A(Z)*UM;:PRINT " ";UM$;" (#";W;"AWG)"
- 1020 LIN=CSRLIN
- 1030 PRINT UL$;
- 1040 PRINT " Press number in < > to choose how you want to select wire:"
- 1050 PRINT UL$;
- 1060 PRINT " < 1 > by Diameter"
- 1070 PRINT " < 2 > by AWG #"
- 1080 Z$=INKEY$
- 1090 IF Z$="1"THEN GOSUB 1130:GOTO 1160
- 1100 IF Z$="2"THEN GOSUB 1130:GOTO 1230
- 1110 GOTO 1080
- 1120 '
- 1130 VIEW PRINT LIN TO 24:CLS:VIEW PRINT:LOCATE LIN
- 1140 RETURN
- 1150 '
- 1160 '.....size by diameter
- 1170 PRINT " ENTER: Shunt Wire diameter.............(";UM$;")";:INPUT Q
- 1180 GOSUB 610:PRINT " ";UM$
- 1190 LOCATE CSRLIN-1,4:PRINT "USE:"
- 1200 DIA=Q/UM 'wire diameter in inches
- 1210 GOTO 1300
- 1220 '
- 1230 '.....size by AWG
- 1240 INPUT " ENTER: Selected Shunt Wire diameter.......(AWG#)";X
- 1250 Q=A(X)*UM:GOSUB 610:PRINT " ";UM$;" (#";X;"AWG)"
- 1260 LOCATE CSRLIN-1,4:PRINT "USE:"
- 1270 DIA=A(X) 'wire diameter in inches
- 1280 GOTO 1300
- 1290 '
- 1300 IF DIA>=INT(A(Z)*10^3)/10^3 THEN 1350
- 1310 BEEP:COLOR 0,7
- 1320 PRINT:PRINT " CURRENT EXCEEDS WIRE CAPACITY !"
- 1330 COLOR 7,0:GOTO 960
- 1340 '
- 1350 IF UM=1 THEN M=UM:M$="in."ELSE M=2.54:M$="cm."
- 1360 PRINT " ENTER: Shunt Wire Coil diameter........(";M$;")";:INPUT D
- 1370 IF D=0 THEN LOCATE CSRLIN-1:GOTO 1350
- 1380 D=D/M
- 1390 LOCATE CSRLIN-1:PRINT ER$;:LOCATE CSRLIN-1
- 1400 CM=(DIA*10^3)^2 'circular mils
- 1410 OMFT=10371/CM 'ohms per 1000 feet
- 1420 R=OMFT/12000 'ohms per inch
- 1430 N=B/A 'factor by which original meter scale is to be multiplied
- 1440 S=RM/(N-1) 'shunt resistance
- 1450 L=S/R 'shunt length
- 1460 PRINT TAB(9);"Shunt resistance.....................";USING U$;S;
- 1470 PRINT " ohms"
- 1480 PRINT TAB(9);"Shunt Wire capacity..................";USING U$;CM/250;
- 1490 PRINT " amps"
- 1500 IF UM=1 THEN M=UM:M$=UM$ ELSE M=2.54:M$="cm."
- 1510 PRINT TAB(9);"Shunt Wire length....................";USING U$;L*M;
- 1520 PRINT " ";M$
- 1530 PRINT TAB(9);"Shunt Coil diameter..................";USING U$;D*M;
- 1540 PRINT " ";M$
- 1550 PRINT TAB(9);"Shunt Coil length....................";USING U$;L/D/PI;
- 1560 PRINT " turns"
- 1570 PRINT UL$;
- 1580 T=7
- 1590 PRINT TAB(T);
- 1600 PRINT " Resistance wire may be wound in a coil as suggested, or it may be"
- 1610 PRINT TAB(T);
- 1620 PRINT " wound in a loop around the inside walls of the chassis, or even"
- 1630 PRINT TAB(T);
- 1640 PRINT " bundled or bunched in any random fashion.";
- 1650 GOTO 2510 'end
- 1660 '
- 1670 '....voltmeter
- 1680 CLS
- 1690 PRINT TAB(36);"VOLTMETER"
- 1700 PRINT UL$;
- 1710 PRINT
- 1720 T=27:COLOR 0,7
- 1730 LOCATE CSRLIN,T:PRINT " + SOUNDSOUNDSOUNDBSAVESOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUND "
- 1740 LOCATE CSRLIN,T:PRINT " CALL multiplier "
- 1750 LOCATE CSRLIN,T:PRINT " CLSSOUNDSOUNDSOUND\/\/\/SOUNDSOUNDCOLOR "
- 1760 LOCATE CSRLIN,T:PRINT " VARPTRSOUNDMOTORSOUNDCOLOR+ "
- 1770 LOCATE CSRLIN,T:PRINT " meterCALL \ CALL "
- 1780 LOCATE CSRLIN,T:PRINT " CLSSOUNDBSAVESOUND'- "
- 1790 LOCATE CSRLIN,T:PRINT " - SOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDMOTORSOUNDSOUNDSOUNDSOUNDSOUND "
- 1800 COLOR 7,0
- 1810 PRINT
- 1820 INPUT " ENTER: Meter Movement - Full Scale.....(mA.)";Z:I=Z/1000
- 1830 Q=Z:GOSUB 610:PRINT " mA."
- 1840 RM=0 'internal resistance
- 1850 PRINT " Is the internal resistance of the meter known? (y/n)"
- 1860 Z$=INKEY$
- 1870 IF Z$="Y"OR Z$="y"THEN LOCATE CSRLIN-1:PRINT ER$:LOCATE CSRLIN-2:GOTO 1900
- 1880 IF Z$="N"OR Z$="n"THEN LOCATE CSRLIN-1:PRINT ER$:LOCATE CSRLIN-2:GOTO 1920
- 1890 GOTO 1860
- 1900 INPUT " ENTER: Internal Resistance............(ohms)";RM
- 1910 Q=RM:GOSUB 610:PRINT " ohms":GOTO 1960
- 1920 PRINT " Internal Resistance.................."
- 1930 RM=100
- 1940 Q=RM:GOSUB 610:PRINT " ohms (assumed)"
- 1950 '
- 1960 INPUT " ENTER: Desired Full Scale Reading....(volts)";E
- 1970 Q=E:GOSUB 610:PRINT " volts"
- 1980 '
- 1990 R=E/I-RM
- 2000 PRINT " Multiplier Resistor.................."
- 2010 Q=R:GOSUB 610:PRINT " ohms"
- 2020 '
- 2030 VR=RM+R
- 2040 PRINT " Total Voltmeter Resistance..........."
- 2050 Q=VR:GOSUB 610:PRINT " ohms"
- 2060 '
- 2070 S=(R+RM)/E
- 2080 PRINT " Voltmeter Sensitivity................"
- 2090 Q=S:GOSUB 610:PRINT " ohms per volt"
- 2100 '
- 2110 GOSUB 2560 'screen dump
- 2120 CLS:CHAIN"precires"
- 2130 END
- 2140 '
- 2150 '.....meter shunt preface
- 2160 TB=8 'tab for text
- 2170 PRINT TAB(TB);
- 2180 PRINT "It is necessary to know the meter's internal resistance before"
- 2190 PRINT TAB(TB);
- 2200 PRINT "the required value for a shunt can be calculated. The internal"
- 2210 PRINT TAB(TB);
- 2220 PRINT "resistance may vary from a fraction of an ohm to a few thousand"
- 2230 PRINT TAB(TB);
- 2240 PRINT "ohms, with the higher resistance values associated with higher"
- 2250 PRINT TAB(TB);
- 2260 PRINT "sensitivity."
- 2270 PRINT
- 2280 PRINT TAB(TB);
- 2290 PRINT "Often the resistance of a particular meter will be unknown. This"
- 2300 PRINT TAB(TB);
- 2310 PRINT "is usually the case when a meter is purchased at a flea market or"
- 2320 PRINT TAB(TB);
- 2330 PRINT "is obtained from a commercial piece of equipment. Unfortunately"
- 2340 PRINT TAB(TB);
- 2350 PRINT "the internal resistance of a meter CANNOT be measured directly"
- 2360 PRINT TAB(TB);
- 2370 PRINT "with a VOM or VTVM without risk of damage to the meter movement."
- 2380 PRINT TAB(TB);
- 2390 PRINT
- 2400 PRINT TAB(TB);
- 2410 PRINT "However, most modern digital multimeters CAN be used to measure"
- 2420 PRINT TAB(TB);
- 2430 PRINT "the internal resistance of a meter directly."
- 2440 PRINT
- 2450 PRINT TAB(TB);
- 2460 PRINT "Refer to the ARRL Handbook for methods of measuring the internal"
- 2470 PRINT TAB(TB);
- 2480 PRINT "resistance of a meter using a VOM or VTVM."
- 2490 RETURN
- 2500 '
- 2510 '.....end
- 2520 GOSUB 2560
- 2530 CLS:GOTO 210
- 2540 END
- 2550 '
- 2560 'HARDCOPY
- 2570 GOSUB 2680:LOCATE 25,2:COLOR 14,6
- 2580 PRINT " Press 1 to print screen, 2 to print screen & ";
- 2590 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 2600 Z$=INKEY$:IF Z$="3"THEN GOSUB 2680:RETURN
- 2610 IF Z$="1"OR Z$="2"THEN GOSUB 2680:GOTO 2630
- 2620 GOTO 2600
- 2630 FOR QX=1 TO 24:FOR QY=1 TO 80
- 2640 LPRINT CHR$(SCREEN(QX,QY));
- 2650 NEXT QY:NEXT QX
- 2660 IF Z$="2"THEN LPRINT CHR$(12)
- 2670 GOTO 2570
- 2680 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-